﻿
@{

    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.Title = "Home Page";
}

<h2>TESTE</h2>
<p>
    To learn more about jsTree visit <a href="http://www.jstree.com/">http://www.jstree.com/</a>.

</p>

@using (Html.BeginForm("Results", "Home", FormMethod.Post))
{
    <div id="demoTree"></div>
    <br />
    <div>
        <input type="submit" value="Submit" id="btnSubmit" />
    </div>
}


<script src="@Url.Content("~/Scripts/jquery.jstree.js")" type="text/javascript"></script>
<script type="text/javascript">

    treeModel = @Html.Raw(ViewBag.jsonModel);

    $(function () {
        $("#demoTree").jstree({
            json_data: {
                data: treeModel
            },
            themes : { icons : false , stripes : true},
            checkbox: {
                real_checkboxes: true,
                real_checkboxes_names: function (n) {
                    return [("check_" + (n[0].id || Math.ceil(Math.random() * 10000))), n[0].id]
                }
            },
            plugins: ["themes","json_data", "checkbox"]
        }).bind("loaded.jstree", function (event, data) {
            $('#demoTree').jstree('check_node', 'li[selected=selected]');
        });
    });

   
  
</script>


